package cn.factorybox.common.utils.resultUtils;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-03-12 19:31
 */


import cn.factorybox.model.entity.JudgeValue;

/**
 * 结果预测
 */
public class ExpertUtils {

    public static String getResult(double[][] m3) {
        String j;
        String r;
        double m;
        double k;
        if (m3[0][0] > m3[0][1]) {
            m = m3[0][0];
            j = "优秀";
        } else{
            m = m3[0][1];
            j = "良好";
        }
        if (m3[0][2] > m3[0][3]) {
            k = m3[0][2];
            r = "一般";
        } else {
            k = m3[0][3];
            r = "不适";
        }
        if (m > k) {
            return j;
        } else {
            return r;
        }
    }
/******************************室内判断*****************************/

    /**
     * 判断温度
     * @param m 温度值
     * @param R 判断条件范围
     */
    public static void judgeTemperature_indoor(double m, double[][] R, JudgeValue jv1) {
        if (m >= jv1.getYouxiuMin() && m <= jv1.getYouxiuMax()) {
            R[0][0] = 1;
        } else if ((m >= jv1.getLianghaoMin1() && m < jv1.getLianghaoMax1()) || (m > jv1.getLianghaoMin2() && m <= jv1.getLianghaoMax2())) {
            R[0][1] = 1;
        } else if ((m >= jv1.getYibanMin1() && m < jv1.getYibanMax1()) || (m > jv1.getYibanMin2() && m <= jv1.getYibanMax2())) {
            R[0][2] = 1;
        } else if (m < jv1.getWeixianMin() || m > jv1.getWeixianMax()) {
            R[0][3] = 1;
        }
    }

    /**
     * 判断湿度
     * @param m 湿度值
     * @param R 判断条件范围
     */
    public static void judgeHumidity_indoor(double m, double[][] R, JudgeValue jv2) {
        if (m >= jv2.getYouxiuMin() && m <= jv2.getYouxiuMax()) {
            R[1][0] = 1;
        } else if ((m >= jv2.getLianghaoMin1() && m < jv2.getLianghaoMax1()) || (m > jv2.getLianghaoMin2() && m <= jv2.getLianghaoMax2())) {
            R[1][1] = 1;
        } else if ((m >= jv2.getYibanMin1() && m < jv2.getYibanMax1()) || (m > jv2.getYibanMin2() && m <= jv2.getYibanMax2())) {
            R[1][2] = 1;
        } else if (m < jv2.getWeixianMin() || m > jv2.getWeixianMax()) {
            R[1][3] = 1;
        }
    }

    /**
     * 判断室内压强
     * @param m 室内压强
     * @param R 判断条件范围
     */
    public static void judgePressure_indoor(double m, double[][] R, JudgeValue jv3) {
        if (m >= jv3.getYouxiuMin() && m <= jv3.getYouxiuMax()) {
            R[2][0] = 1;
        } else if ((m >= jv3.getLianghaoMin1() && m < jv3.getLianghaoMax1()) || (m > jv3.getLianghaoMin2() && m <= jv3.getLianghaoMax2())) {
            R[2][1] = 1;
        } else if ((m >= jv3.getYibanMin1() && m < jv3.getYibanMax1()) || (m > jv3.getYibanMin2() && m <= jv3.getYibanMax2())) {
            R[2][2] = 1;
        } else if (m < jv3.getWeixianMin() || m > jv3.getWeixianMax()) {
            R[2][3] = 1;
        }
    }


    /**
     * 判断排气量
     * @param m 排气量
     * @param R 判断条件范围
     */
    public static void judgeExhaust_indoor(double m, double[][] R, JudgeValue jv4) {
        if (m >= jv4.getYouxiuMin() && m <= jv4.getYouxiuMax()) {
            R[3][0] = 1;
        } else if ((m >= jv4.getLianghaoMin1() && m < jv4.getLianghaoMax1()) || (m > jv4.getLianghaoMin2())) {
            R[3][1] = 1;
        } else if (m >= jv4.getYibanMin1() && m < jv4.getYibanMax1()) {
            R[3][2] = 1;
        } else if (m >= jv4.getWeixianMin() && m < jv4.getWeixianMax()) {
            R[3][3] = 1;
        }
    }

    /**
     * 判断PM2.5
     * @param m PM2.5
     * @param R 判断条件范围
     */
    public static void judgePM_indoor(double m, double[][] R, JudgeValue jv5) {
        if (m >= jv5.getYouxiuMin() && m <= jv5.getYouxiuMax()) {
            R[4][0] = 1;
        } else if (m > jv5.getLianghaoMin1() && m <= jv5.getLianghaoMax1()){
            R[4][1] = 1;
        } else if (m > jv5.getYibanMin1() && m <= jv5.getYibanMax1()) {
            R[4][2] = 1;
        } else if (m > jv5.getWeixianMin()) {
            R[4][3] = 1;
        }
    }

    public static void judgeCO2_indoor(double m, double[][] R, JudgeValue jv6) {
        if (m >= jv6.getYouxiuMin() && m <= jv6.getYouxiuMax()) {
            R[5][0] = 1;
        } else if (m > jv6.getLianghaoMin1() && m <= jv6.getLianghaoMax1()) {
            R[5][1] = 1;
        } else if (m > jv6.getYibanMin1() && m <= jv6.getYibanMax1()) {
            R[5][2] = 1;
        } else if (m > jv6.getWeixianMin()) {
            R[5][3] = 1;
        }
    }

    public static void judgeTVOC_indoor(double m, double[][] R, JudgeValue jv7) {
        if (m >= jv7.getYouxiuMin() && m <= jv7.getYouxiuMax()) {
            R[6][0] = 1;
        } else if (m > jv7.getLianghaoMin1() && m <= jv7.getLianghaoMax1()) {
            R[6][1] = 1;
        } else if (m > jv7.getYibanMin1() && m <= jv7.getYibanMax1()) {
            R[6][2] = 1;
        } else if (m > jv7.getWeixianMin()) {
            R[6][3] = 1;
        }
    }



/******************************实验室判断****************************/

    /**
     * 判断温度
     * @param m 温度值
     * @param R 判断条件范围
     */
    public static void judgeTemperature_exper(double m, double[][] R, JudgeValue jv1) {
        if (m >= jv1.getYouxiuMin() && m <= jv1.getYouxiuMax()) {
            R[0][0] = 1;
        } else if ((m >= jv1.getLianghaoMin1() && m < jv1.getLianghaoMax1()) || (m > jv1.getLianghaoMin2() && m <= jv1.getLianghaoMax2())) {
            R[0][1] = 1;
        } else if ((m >= jv1.getYibanMin1() && m < jv1.getYibanMax1()) || (m > jv1.getYibanMin2() && m <= jv1.getYibanMax2())) {
            R[0][2] = 1;
        } else if (m < jv1.getWeixianMin() || m > jv1.getWeixianMax()) {
            R[0][3] = 1;
        }
    }

    /**
     * 判断湿度
     * @param m 湿度值
     * @param R 判断条件范围
     */
    public static void judgeHumidity_exper(double m, double[][] R, JudgeValue jv2) {
        if (m >= jv2.getYouxiuMin() && m <= jv2.getYouxiuMax()) {
            R[1][0] = 1;
        } else if ((m >= jv2.getLianghaoMin1() && m < jv2.getLianghaoMax1()) || (m > jv2.getLianghaoMin2() && m <= jv2.getLianghaoMax2())) {
            R[1][1] = 1;
        } else if ((m >= jv2.getYibanMin1() && m < jv2.getYibanMax1()) || (m > jv2.getYibanMin2() && m <= jv2.getYibanMax2())) {
            R[1][2] = 1;
        } else if (m < jv2.getWeixianMin() || m > jv2.getWeixianMax()) {
            R[1][3] = 1;
        }
    }

    /**
     * 判断室内压强
     * @param m 室内压强
     * @param R 判断条件范围
     */
    public static void judgePressure_exper(double m, double[][] R, JudgeValue jv3) {
        if (m >= jv3.getYouxiuMin()) {
            R[2][0] = 1;
        } else if (m >= jv3.getLianghaoMin1() && m < jv3.getLianghaoMax1()) {
            R[2][1] = 1;
        } else if (m >= jv3.getYibanMin1() && m < jv3.getYibanMax1()) {
            R[2][2] = 1;
        } else if (m < jv3.getWeixianMin()) {
            R[2][3] = 1;
        }
    }


    /**
     * 判断排气量
     * @param m 排气量
     * @param R 判断条件范围
     */
    public static void judgeExhaust_exper(double m, double[][] R, JudgeValue jv4) {
        if (m >= jv4.getYouxiuMin() && m <= jv4.getYouxiuMax()) {
            R[3][0] = 1;
        } else if ((m >= jv4.getLianghaoMin1() && m < jv4.getLianghaoMax1()) || (m > jv4.getLianghaoMin2())) {
            R[3][1] = 1;
        } else if (m >= jv4.getYibanMin1() && m < jv4.getYibanMax1()) {
            R[3][2] = 1;
        } else if (m > jv4.getWeixianMin() && m < jv4.getWeixianMax()) {
            R[3][3] = 1;
        }
    }

    /**
     * 判断PM2.5
     * @param m PM2.5
     * @param R 判断条件范围
     */
    public static void judgePM_exper(double m, double[][] R, JudgeValue jv5) {
        if (m >= jv5.getYouxiuMin() && m <= jv5.getYouxiuMax()) {
            R[4][0] = 1;
        } else if (m > jv5.getLianghaoMin1() && m <= jv5.getLianghaoMax1()){
            R[4][1] = 1;
        } else if (m > jv5.getYibanMin1() && m <= jv5.getYibanMax1()) {
            R[4][2] = 1;
        } else if (m > jv5.getWeixianMin()) {
            R[4][3] = 1;
        }
    }

    public static void judgeCO2_exper(double m, double[][] R, JudgeValue jv6) {
        if (m >= jv6.getYouxiuMin() && m <= jv6.getYouxiuMax()) {
            R[5][0] = 1;
        } else if (m > jv6.getLianghaoMin1() && m <= jv6.getLianghaoMax1()) {
            R[5][1] = 1;
        } else if (m > jv6.getYibanMin1() && m <= jv6.getYibanMax1()) {
            R[5][2] = 1;
        } else if (m > jv6.getWeixianMin()) {
            R[5][3] = 1;
        }
    }

    public static void judgeTVOC_exper(double m, double[][] R, JudgeValue jv7) {
        if (m >= jv7.getYouxiuMin() && m <= jv7.getYouxiuMax()) {
            R[6][0] = 1;
        } else if (m > jv7.getLianghaoMin1() && m <= jv7.getLianghaoMax1()) {
            R[6][1] = 1;
        } else if (m > jv7.getYibanMin1() && m <= jv7.getYibanMax1()) {
            R[6][2] = 1;
        } else if (m > jv7.getWeixianMin()) {
            R[6][3] = 1;
        }
    }

/************************室外判断*************************/

    /**
     * 判断温度
     * @param m 温度值
     * @param R 判断条件范围
     */
    public static void judgeTemperature_outdoor(double m, double[][] R, JudgeValue jv1) {
        if (m >= jv1.getYouxiuMin() && m <= jv1.getYouxiuMax()) {
            R[0][0] = 1;
        } else if ((m >= jv1.getLianghaoMin1() && m < jv1.getLianghaoMax1()) || (m > jv1.getLianghaoMin2() && m <= jv1.getLianghaoMax2())) {
            R[0][1] = 1;
        } else if ((m >= jv1.getYibanMin1() && m < jv1.getYibanMax1()) || (m > jv1.getYibanMin2() && m <= jv1.getYibanMax2())) {
            R[0][2] = 1;
        } else if (m < jv1.getWeixianMin() || m > jv1.getWeixianMax()) {
            R[0][3] = 1;
        }
    }

    /**
     * 判断湿度
     * @param m 湿度值
     * @param R 判断条件范围
     */
    public static void judgeHumidity_outdoor(double m, double[][] R, JudgeValue jv2) {
        if (m >= jv2.getYouxiuMin() && m <= jv2.getYouxiuMax()) {
            R[1][0] = 1;
        } else if ((m >= jv2.getLianghaoMin1() && m < jv2.getLianghaoMax1()) || (m > jv2.getLianghaoMin2() && m <= jv2.getLianghaoMax2())) {
            R[1][1] = 1;
        } else if ((m >= jv2.getYibanMin1() && m < jv2.getYibanMax1()) || (m > jv2.getYibanMin2() && m <= jv2.getYibanMax2())) {
            R[1][2] = 1;
        } else if (m < jv2.getWeixianMin() || m > jv2.getWeixianMax()) {
            R[1][3] = 1;
        }
    }

    /**
     * 判断室内压强
     * @param m 室内压强
     * @param R 判断条件范围
     */
    public static void judgePressure_outdoor(double m, double[][] R, JudgeValue jv3) {
        if (m >= jv3.getYouxiuMin() && m <= jv3.getYouxiuMax()) {
            R[2][0] = 1;
        } else if ((m >= jv3.getLianghaoMin1() && m < jv3.getLianghaoMax1()) || (m > jv3.getLianghaoMin2() && m <= jv3.getLianghaoMax2())) {
            R[2][1] = 1;
        } else if ((m >= jv3.getYibanMin1() && m < jv3.getYibanMax1()) || (m > jv3.getYibanMin2() && m <= jv3.getYibanMax2())) {
            R[2][2] = 1;
        } else if (m < jv3.getWeixianMin() || m > jv3.getWeixianMax()) {
            R[2][3] = 1;
        }
    }


    /**
     * 判断排气量
     * @param m 排气量
     * @param R 判断条件范围
     */
    public static void judgeExhaust_outdoor(double m, double[][] R, JudgeValue jv4) {
        if (m >= jv4.getYouxiuMin() && m <= jv4.getYouxiuMax()) {
            R[3][0] = 1;
        } else if ((m >= jv4.getLianghaoMin1() && m < jv4.getLianghaoMax1()) || (m > jv4.getLianghaoMin2() && m <= jv4.getLianghaoMax2())) {
            R[3][1] = 1;
        } else if ((m >= jv4.getYibanMin1() && m < jv4.getYibanMax1()) || (m > jv4.getYibanMin2() && m <= jv4.getYibanMax2())) {
            R[3][2] = 1;
        } else if (m >= 0 && m < jv4.getWeixianMin() || m > jv4.getWeixianMax()) {
            R[3][3] = 1;
        }
    }

    /**
     * 判断PM2.5
     * @param m PM2.5
     * @param R 判断条件范围
     */
    public static void judgePM_outdoor(double m, double[][] R, JudgeValue jv5) {
        if (m >= jv5.getYouxiuMin() && m <= jv5.getYouxiuMax()) {
            R[4][0] = 1;
        } else if (m > jv5.getLianghaoMin1() && m <= jv5.getLianghaoMax1()){
            R[4][1] = 1;
        } else if (m > jv5.getYibanMin1() && m <= jv5.getYibanMax1()) {
            R[4][2] = 1;
        } else if (m > jv5.getWeixianMin()) {
            R[4][3] = 1;
        }
    }

    public static void judgeCO2_outdoor(double m, double[][] R, JudgeValue jv6) {
        if (m >= jv6.getYouxiuMin() && m <= jv6.getYouxiuMax()) {
            R[5][0] = 1;
        } else if (m > jv6.getLianghaoMin1() && m <= jv6.getLianghaoMax1()) {
            R[5][1] = 1;
        } else if (m > jv6.getYibanMin1() && m <= jv6.getYibanMax1()) {
            R[5][2] = 1;
        } else if (m > jv6.getWeixianMin()) {
            R[5][3] = 1;
        }
    }

    public static void judgeTVOC_outdoor(double m, double[][] R, JudgeValue jv7) {
        if (m >= jv7.getYouxiuMin() && m <= jv7.getYouxiuMax()) {
            R[6][0] = 1;
        } else if (m > jv7.getLianghaoMin1() && m <= jv7.getLianghaoMax1()) {
            R[6][1] = 1;
        } else if (m > jv7.getYibanMin1() && m <= jv7.getYibanMax1()) {
            R[6][2] = 1;
        } else if (m > jv7.getWeixianMin()) {
            R[6][3] = 1;
        }
    }
}
